function CheckPeopleInfo(roomcount){
				roomcount=$("#roomcount").val();
			 	for(i=0;i<roomcount;i++){
				 	if($("#username"+i).val()==""){
				 		$("#username"+i).addClass("onFormError");
				 		$("#errorMessageUsername"+i).css({"display": ""});
	  					var str="<p>入住人姓名不能为空!!</p><div class=\"inArr\"></div>";
	  					$("#errorContentUsername"+i).html(str);
	  					$("#username"+i).focus();
				 		return;
				 	}else{
				 		var tempUser=$("#username"+i).val();
				 		if(tempUser.indexOf("代订")!=-1 || tempUser.indexOf("代定")!=-1){
				 		$("#userNameLi"+i).css({"z-index": "3"});
				 		$("#username"+i).addClass("onFormError");
				 		$("#errorMessageUsername"+i).addClass("errorLeftPrompt");
				 		$("#errorMessageUsername"+i).removeClass("defaultLeftPrompt");
				 		$("#errorMessageUsername"+i).css({"display": ""});
	  					var str="<p>请不要代订，以免影响您的入住。</p><div class=\"inArr\"></div>";
	  					$("#errorContentUsername"+i).html(str);
	  					$("#username"+i).focus();
				 		return;
				 		}else{
				 		$("#userNameLi"+i).css({"z-index": ""});
				 		$("#errorMessageUsername"+i).addClass("defaultLeftPrompt");
				 		$("#errorMessageUsername"+i).removeClass("errorLeftPrompt");
				 		$("#username"+i).removeClass("onFormError");
				 		$("#errorMessageUsername"+i).css({"display": "none"});
				 		}
				 	}
			 	}
			 	if($("#contactuser").val()==""){
			 		$("#contactuser").addClass("onFormError");
			 		$("#errorMessageContactuser").css({"display": ""});
  					var str="<p>联系人姓名不能为空!!</p><div class=\"inArr\"></div>";
  					$("#errorContentContactuser").html(str);
			 		$("#contactuser").focus();
			 		return;
			 	}else{
			 		$("#contactuser").removeClass("onFormError");
			 		$("#errorMessageContactuser").css({"display": "none"});
			 	}
			 	
			 	if($("#mobilephone").val()==""){
			 		$("#mobilephone").addClass("onFormError");
			 		$("#errorMessageMobilephone").css({"display": ""});
  					var str="<p>手机号不能为空!!</p><div class=\"inArr\"></div>";
  					$("#errorContentMobilephone").html(str);
			 		$("#mobilephone").focus();
			 		return;
			 	}else{
			 		$("#mobilephone").removeClass("onFormError");
			 		$("#errorMessageMobilephone").css({"display": "none"});
			 	}
			 	
			 	if($("#mobilephone").val()!=""){
			 		var phonePat=/^(?:13\d|15\d|18\d)-?\d{5}(\d{3}|\*{3})$/;
					var phonematchArray=$("#mobilephone").val().match(phonePat);
					if (phonematchArray==null) {
					$("#mobilephone").addClass("onFormError");
					$("#errorMessageMobilephone").css({"display": ""});
  					var str="<p>手机格式不正确!!</p><div class=\"inArr\"></div>";
  					$("#errorContentMobilephone").html(str);
			 		$("#mobilephone").focus();
					return;
			 		}
			 	}else{
			 		$("#mobilephone").removeClass("onFormError");
			 		$("#errorMessageMobilephone").css({"display": "none"});
			 	}
			 
			 
			 	/*	if($("#email").val()==""){
			 		$("#email").addClass("onFormError");
			 		$("#errorMessageEmail").css({"display": ""});
  					var str="<p>电子邮箱不能为空!!</p><div class=\"inArr\"></div>";
  					$("#errorContentEmail").html(str);
			 		$("#email").focus();
			 		return;
			 	}else{
			 		$("#email").removeClass("onFormError");
			 		$("#errorMessageEmail").css({"display": "none"});
			 	}
			 	
			 	if($("#email").val()!=""){
			 		if($("#email").val().indexOf("@")==-1){
			 			$("#email").addClass("onFormError");
			 			$("#errorMessageEmail").css({"display": ""});
  						var str="<p>电子邮箱格式不正确!!</p><div class=\"inArr\"></div>";
  						$("#errorContentEmail").html(str);
			 			$("#email").focus();
			 			return;
					}
						tempmsg=$("#email").val().substring(0,$("#email").val().indexOf("@"));
						if(tempmsg.length<3){
						$("#email").addClass("onFormError");
						$("#errorMessageEmail").css({"display": ""});
  						var str="<p>电子邮箱格式不正确!!</p><div class=\"inArr\"></div>";
  						$("#errorContentEmail").html(str);
			 			$("#email").focus();
			 			return;
						}
						if(!(($("#email").val().indexOf(".com")!=-1)||($("#email").val().indexOf(".cn")!=-1)||($("#email").val().indexOf(".net")!=-1)||($("#email").val().indexOf(".net")!=-1)||($("#email").val().indexOf(".edu")!=-1))){
						$("#email").addClass("onFormError");
						$("#errorMessageEmail").css({"display": ""});
  						var str="<p>电子邮箱格式不正确!!</p><div class=\"inArr\"></div>";
  						$("#errorContentEmail").html(str);
			 			$("#email").focus();
			 			return;
						}
						tempmsg=$("#email").val().substring(($("#email").val().indexOf("@")+1),$("#email").val().indexOf("."));
						if(tempmsg.length<2){
						$("#email").addClass("onFormError");
						$("#errorMessageEmail").css({"display": ""});
  						var str="<p>电子邮箱格式不正确!!</p><div class=\"inArr\"></div>";
  						$("#errorContentEmail").html(str);
			 			$("#email").focus();
			 			return;
					}
					$("#email").removeClass("onFormError");
					$("#errorMessageEmail").css({"display": "none"});
			 	}
			 	if($("#desrc").val().length>140){
			 		alert("备注只能在140个字以内。");
			 		$("#desrc").focus();
			 		return;
			 	}*/
			 	
			 	if(document.getElementById("agreeWebOrder").checked!=true){
			 		alert("请阅读并同意网上预订须知。");
			 		$("#agreeWebOrder").focus();
			 		return;
			 	}
				$("#iscontactbf").val($("#iscontactbf_up").val());
				$("#bfprice").val($("#bfprice_up").val());
				$("#bftype").val($("#bftype_up").val());
				$("#isfreenet").val($("#isfreenet_up").val());
				$("#hotelname").val($("#hotelname_up").val());
				$("#roomtypename").val($("#roomtypename_up").val());
				$("#roomavg").val($("#roomavg_up").val());
				
				$("#hotelmoney").val($("#hotelmoney_up").val());
				
				$("#servcweekendpercent").val($("#servcweekendpercent_up").val());
				$("#starlv").val($("#starlv_up").val());
				$("#address").val($("#address_up").val());
				$("#isformal").val($("#isformal_up").val());
				$("#roomcount_up").val($("#roomcount").val());
				$("#everydayprice").val($("#everydayprice_up").val());
				$("#form2").submit(); 
}

function CheckPeopleInfoHistory(roomcount){
				roomcount=$("#roomcount").val();
			 	for(i=0;i<roomcount;i++){
			 	if($("#username"+i).val()==""){
			 		$("#username"+i).addClass("onFormError");
			 		$("#errorMessageUsername"+i).css({"display": ""});
  					var str="<p>入住人姓名不能为空!!</p><div class=\"inArr\"></div>";
  					$("#errorContentUsername"+i).html(str);
  					$("#username"+i).focus();
			 		return;
			 	}else{
			 		var tempUser=$("#username"+i).val();
			 		if(tempUser.indexOf("代订")!=-1 || tempUser.indexOf("代定")!=-1){
			 		$("#userNameLi"+i).css({"z-index": "3"});
			 		$("#username"+i).addClass("onFormError");
			 		$("#errorMessageUsername"+i).addClass("errorLeftPrompt");
			 		$("#errorMessageUsername"+i).removeClass("defaultLeftPrompt");
			 		$("#errorMessageUsername"+i).css({"display": ""});
  					var str="<p>请不要代订，以免影响您的入住。</p><div class=\"inArr\"></div>";
  					$("#errorContentUsername"+i).html(str);
  					$("#username"+i).focus();
			 		return;
			 		}else{
			 		$("#userNameLi"+i).css({"z-index": ""});
			 		$("#errorMessageUsername"+i).addClass("defaultLeftPrompt");
			 		$("#errorMessageUsername"+i).removeClass("errorLeftPrompt");
			 		$("#username"+i).removeClass("onFormError");
			 		$("#errorMessageUsername"+i).css({"display": "none"});
			 		}
			 	}
			 	
			 	}
			 
			 	if($("#contactuser").val()==""){
			 		$("#contactuser").addClass("onFormError");
			 		$("#errorMessageContactuser").css({"display": ""});
  					var str="<p>联系人姓名不能为空!!</p><div class=\"inArr\"></div>";
  					$("#errorContentContactuser").html(str);
			 		$("#contactuser").focus();
			 		return;
			 	}else{
			 		$("#contactuser").removeClass("onFormError");
			 		$("#errorMessageContactuser").css({"display": "none"});
			 	}
			 	
			 	if($("#mobilephone").val()==""){
			 		$("#mobilephone").addClass("onFormError");
			 		$("#errorMessageMobilephone").css({"display": ""});
  					var str="<p>手机号不能为空!!</p><div class=\"inArr\"></div>";
  					$("#errorContentMobilephone").html(str);
			 		$("#mobilephone").focus();
			 		return;
			 	}else{
			 		$("#mobilephone").removeClass("onFormError");
			 		$("#errorMessageMobilephone").css({"display": "none"});
			 	}
			 	
			 	if($("#mobilephone").val()!=""){
			 		var phonePat=/^(?:13\d|15\d|18\d)-?\d{5}(\d{3}|\*{3})$/;
					var phonematchArray=$("#mobilephone").val().match(phonePat);
					if (phonematchArray==null) {
					$("#mobilephone").addClass("onFormError");
					$("#errorMessageMobilephone").css({"display": ""});
  					var str="<p>手机格式不正确!!</p><div class=\"inArr\"></div>";
  					$("#errorContentMobilephone").html(str);
			 		$("#mobilephone").focus();
					return;
			 		}
			 	}else{
			 		$("#mobilephone").removeClass("onFormError");
			 		$("#errorMessageMobilephone").css({"display": "none"});
			 	}
			 
			 
			 	/*	if($("#email").val()==""){
			 		$("#email").addClass("onFormError");
			 		$("#errorMessageEmail").css({"display": ""});
  					var str="<p>电子邮箱不能为空!!</p><div class=\"inArr\"></div>";
  					$("#errorContentEmail").html(str);
			 		$("#email").focus();
			 		return;
			 	}else{
			 		$("#email").removeClass("onFormError");
			 		$("#errorMessageEmail").css({"display": "none"});
			 	}
			 	
			 	if($("#email").val()!=""){
			 		if($("#email").val().indexOf("@")==-1){
			 			$("#email").addClass("onFormError");
			 			$("#errorMessageEmail").css({"display": ""});
  						var str="<p>电子邮箱格式不正确!!</p><div class=\"inArr\"></div>";
  						$("#errorContentEmail").html(str);
			 			$("#email").focus();
			 			return;
					}
						tempmsg=$("#email").val().substring(0,$("#email").val().indexOf("@"));
						if(tempmsg.length<3){
						$("#email").addClass("onFormError");
						$("#errorMessageEmail").css({"display": ""});
  						var str="<p>电子邮箱格式不正确!!</p><div class=\"inArr\"></div>";
  						$("#errorContentEmail").html(str);
			 			$("#email").focus();
			 			return;
						}
						if(!(($("#email").val().indexOf(".com")!=-1)||($("#email").val().indexOf(".cn")!=-1)||($("#email").val().indexOf(".net")!=-1)||($("#email").val().indexOf(".net")!=-1)||($("#email").val().indexOf(".edu")!=-1))){
						$("#email").addClass("onFormError");
						$("#errorMessageEmail").css({"display": ""});
  						var str="<p>电子邮箱格式不正确!!</p><div class=\"inArr\"></div>";
  						$("#errorContentEmail").html(str);
			 			$("#email").focus();
			 			return;
						}
						tempmsg=$("#email").val().substring(($("#email").val().indexOf("@")+1),$("#email").val().indexOf("."));
						if(tempmsg.length<2){
						$("#email").addClass("onFormError");
						$("#errorMessageEmail").css({"display": ""});
  						var str="<p>电子邮箱格式不正确!!</p><div class=\"inArr\"></div>";
  						$("#errorContentEmail").html(str);
			 			$("#email").focus();
			 			return;
					}
					$("#email").removeClass("onFormError");
					$("#errorMessageEmail").css({"display": "none"});
			 	}
			 	if($("#desrc").val().length>140){
			 		alert("备注只能在140个字以内。");
			 		$("#desrc").focus();
			 		return;
			 	}*/
			 	
			 	if(document.getElementById("agreeWebOrder").checked!=true){
			 		alert("请阅读并同意网上预订须知。");
			 		$("#agreeWebOrder").focus();
			 		return;
			 	}
			 	
				$("#iscontactbf").val($("#iscontactbf_up").val());
				$("#bfprice").val($("#bfprice_up").val());
				$("#bftype").val($("#bftype_up").val());
				$("#isfreenet").val($("#isfreenet_up").val());
				$("#hotelname").val($("#hotelname_up").val());
				$("#roomtypename").val($("#roomtypename_up").val());
				$("#roomavg").val($("#roomavg_up").val());
				
				$("#hotelmoney").val($("#hotelmoney_up").val());
				
				$("#servcweekendpercent").val($("#servcweekendpercent_up").val());
				$("#starlv").val($("#starlv_up").val());
				$("#address").val($("#address_up").val());
				$("#isformal").val($("#isformal_up").val());
				$("#roomcount_up").val($("#roomcount").val());
				$("#everydayprice").val($("#everydayprice_up").val());
				
				$("#form2").submit(); 
}



function  titleMobilePhone(){
				if($("#mobilephone").val()==""){
			 		$("#errorMessageMobilephone").removeClass("errorLeftPrompt");
			 		$("#errorMessageMobilephone").addClass("defaultLeftPrompt");
			 		$("#errorMessageMobilephone").css({"display": ""});
  					var str="<p>请您提供准确的手机号码，以接收订单信息。</p><div class=\"inArr\"></div>";
  					$("#errorContentMobilephone").html(str);
			 	}


}
function  titleMobilePhoneBlue(){
	if($("#mobilephone").val()==""){
	$("#errorMessageMobilephone").css({"display": "none"});
	}else{
	$("#errorMessageMobilephone").removeClass("defaultLeftPrompt");
	var phonePat=/^(?:13\d|15\d|18\d)-?\d{5}(\d{3}|\*{3})$/;
					var phonematchArray=$("#mobilephone").val().match(phonePat);
					if (phonematchArray==null) {
					$("#errorMessageMobilephone").css({"display": ""});
					}else{
					$("#mobilephone").removeClass("onFormError");
					$("#errorMessageMobilephone").css({"display": "none"});
					}
	
	}
}




function  checkMobilePhone(){

			 	if($("#mobilephone").val()!=""){
			 		var phonePat=/^(?:13\d|15\d|18\d)-?\d{5}(\d{3}|\*{3})$/;
					var phonematchArray=$("#mobilephone").val().match(phonePat);
					if (phonematchArray==null) {
			 		$("#errorMessageMobilephone").addClass("errorLeftPrompt");
			 		$("#mobilephone").addClass("onFormError");
					$("#errorMessageMobilephone").css({"display": ""});
  					var str="<p>您输入的手机号码有误，请输入11位的手机号码。</p><div class=\"inArr\"></div>";
  					$("#errorContentMobilephone").html(str);
			 		$("#mobilephone").focus();
					return;
			 		}
			 	}else{
			 		$("#mobilephone").removeClass("onFormError");
			 		$("#errorMessageMobilephone").css({"display": "none"});
			 	}

}


function  titleEmail(){
				if($("#email").val()==""){
			 		$("#errorMessageEmail").removeClass("errorLeftPrompt");
			 		$("#errorMessageEmail").addClass("defaultLeftPrompt");
			 		$("#errorMessageEmail").css({"display": ""});
  					var str="<p>Email将用来接收订单信息，请您正确填写。</p><div class=\"inArr\"></div>";
  					$("#errorContentEmail").html(str);
			 	}


}


function  titleUserName(i){
				$("#countId").val(i);
				$("#divPopCon").css({"display": ""});
				if($("#username"+i).val()==""){
					$("#userNameLi"+i).css({"z-index": "3"});
			 		$("#errorMessageUsername"+i).removeClass("errorLeftPrompt");
			 		$("#errorMessageUsername"+i).addClass("defaultLeftPrompt");
			 		$("#errorMessageUsername"+i).css({"display": ""});
  					var str="<p>请您务必填写实住客人姓名，以免影响您的入住。</p><div class=\"inArr\"></div>";
  					$("#errorContentUsername"+i).html(str);
			 	}
}
function  titleUserNameBlue(i){
	if($("#username"+i).val()!=null && $("#username"+i).val()!="" && $("#username"+i).val()!="undefined"){
	$("#usernamehidden"+i).val($("#username"+i).val());
	}else{
	$("#usernamehidden"+i).val("");
	}
	if($("#username"+i).val()==""){
	$("#userNameLi"+i).css({"z-index": ""});
	$("#username"+i).removeClass("onFormError");
	$("#errorMessageUsername"+i).css({"display": "none"});
	}else{
	var tempUser=$("#username"+i).val();
			 		if(tempUser.indexOf("代订")!=-1 || tempUser.indexOf("代定")!=-1){
			 		$("#userNameLi"+i).css({"z-index": "3"});
			 		$("#username"+i).addClass("onFormError");
			 		$("#errorMessageUsername"+i).addClass("errorLeftPrompt");
			 		$("#errorMessageUsername"+i).removeClass("defaultLeftPrompt");
			 		$("#errorMessageUsername"+i).css({"display": ""});
  					var str="<p>请不要代订，以免影响您的入住。</p><div class=\"inArr\"></div>";
  					$("#errorContentUsername"+i).html(str);
  					
			 		return;
			 		}else{
			 		$("#userNameLi"+i).css({"z-index": ""});
			 		$("#errorMessageUsername"+i).addClass("defaultLeftPrompt");
			 		$("#errorMessageUsername"+i).removeClass("errorLeftPrompt");
			 		$("#username"+i).removeClass("onFormError");
			 		$("#errorMessageUsername"+i).css({"display": "none"});
			 		}
	}
}



function  titleEmailBlue(){
	if($("#email").val()==""){
	$("#email").removeClass("onFormError");
	$("#errorMessageEmail").css({"display": "none"});
	}else{
	
	$("#errorMessageEmail").removeClass("defaultLeftPrompt");
	tempmsg=$("#email").val().substring(0,$("#email").val().indexOf("@"));
	tempmsg1=$("#email").val().substring(($("#email").val().indexOf("@")+1),$("#email").val().indexOf("."));
	if(($("#email").val().indexOf("@")==-1) || tempmsg.length<3 || !(($("#email").val().indexOf(".com")!=-1)||($("#email").val().indexOf(".net")!=-1)||($("#email").val().indexOf(".cn")!=-1)||($("#email").val().indexOf(".edu")!=-1)) || tempmsg1.length<2){
	$("#errorMessageEmail").css({"display": ""});
	}else{
	$("#email").removeClass("onFormError");
	$("#errorMessageEmail").css({"display": "none"});
	}
	}
}

function checkEmail(){

			 	
			 	if($("#email").val()!=""){
			 		tempmsg=$("#email").val().substring(0,$("#email").val().indexOf("@"));
					tempmsg1=$("#email").val().substring(($("#email").val().indexOf("@")+1),$("#email").val().indexOf("."));
					if(($("#email").val().indexOf("@")==-1) || tempmsg.length<3 || !(($("#email").val().indexOf(".com")!=-1)||($("#email").val().indexOf(".net")!=-1)||($("#email").val().indexOf(".cn")!=-1)||($("#email").val().indexOf(".edu")!=-1)) || tempmsg1.length<2){
			 		$("#errorMessageEmail").addClass("errorLeftPrompt");
			 			$("#email").addClass("onFormError");
			 			$("#errorMessageEmail").css({"display": ""});
  						var str="<p>您的email格式不正确。</p><div class=\"inArr\"></div>";
  						$("#errorContentEmail").html(str);
			 			$("#email").focus();
			 			return;
			 		}else{
			 		$("#email").removeClass("onFormError");
			 		$("#errorMessageEmail").css({"display": "none"});
			 		}
			 	}
}
function checkConnectPeople(){
if($("#contactuser").val()==""){
					$("#contactuser").addClass("onFormError");
			 		$("#errorMessageContactuser").css({"display": ""});
  					var str="<p>联系人姓名不能为空!!</p><div class=\"inArr\"></div>";
  					$("#errorContentContactuser").html(str);
			 		$("#contactuser").focus();
			 		return;
			 	}else{
			 		$("#contactuser").removeClass("onFormError");
			 		$("#errorMessageContactuser").css({"display": "none"});
			 	}

}

function addConnectPeople(){
$("#allKeList").html("");
   
var roomcount=$("#roomcount").val();
var str="";
var isDisplay=false;
for(i=0;i<roomcount;i++){
if($("#username"+i).val()!="" && $("#username"+i).val()!=null && $("#username"+i).val()!="null" && $("#username"+i).val()!=undefined){
$("#contactuser").addClass("arred");
$("#contactuser").addClass("cusInput1");
$("#contactuser").removeClass("arreded");
isDisplay=true;
}

}
if(isDisplay){
str+="<div class=\"mBox\" id=\"divPopConNoAlways\" style=\"display: block;\">";
str+="<div class=\"mT\"><span>请直接输入或选择</span><a href=\"javascript:void(0)\" class=\"colseKe\" title=\"关闭\">关闭</a></div>";
str+="<div class=\"mglist\">";
str+="<ul>";
for(i=0;i<roomcount;i++){
if($("#username"+i).val()!=null && $("#username"+i).val()!=""){
str+="<li onclick=\"javascript:setAlwaysName_NoAlways('"+i+"','"+$("#username"+i).val()+"');\">"+$("#username"+i).val()+"";
}
}

str+="</ul>";
str+="</div>";
str+="</div>";



$("#allKeList").html(str);   
$(function(){
	$(".cusInput1").click(function(event){
		event.stopPropagation();
		var offset = $(event.target).offset();
		$("#divPopConNoAlways").css({top:offset.top+2+$(event.target).height()+"px",
		left:offset.left});
		$("#divPopConNoAlways").bgiframe();
		$("#divPopConNoAlways").show();
	});
	$(document).click(function(event){$("#divPopConNoAlways").hide();});
});
//客史绑定事件处理 For IE OR Position
$(function(){
	$(".morekesi1").click(function(event){
		event.stopPropagation();
		var offset = $(event.target).offset();
		$("#divPopConNoAlways").css({top:offset.top+2+$(event.target).height()+"px",
		left:offset.left-144});
		$("#divPopConNoAlways").bgiframe();
		$("#divPopConNoAlways").show();
	});
});
$(function(){
	
	$(".arrde").hover( 
	function () { 
		$(this).addClass("arred");
	}, 
	function () { 
		$(this).removeClass("arred");
	}
	)
	});
	$(".colseKe").click(function(){
		$(".mBox").hide();
	});
	$(".mglist li").hover(function(){
		$(".mglist li").removeClass("current");
		$(this).addClass("current");
	});
	
}else{
$("#contactuser").addClass("arreded");
$("#contactuser").removeClass("arred");
$("#contactuser").removeClass("cusInput1");
}
}

function addBreakFast(totalMoney,bfmoney){
	$("#addBF").html("");
	if(document.getElementById("checkAddbf").checked==true){
		$("#addBF").html("加订早餐<span>&nbsp;¥"+bfmoney+"&nbsp;</span>*<span>&nbsp;"+$("#addbfcount").val()+"&nbsp;</span>份");
		if($("#ishistory").val()==1){
		$("#hotelmoney_up").val((totalMoney*$("#roomcount").val())+(bfmoney*$("#addbfcount").val()));
		}
		$("#allCountCost").html("费用总计：<span>¥"+((totalMoney*$("#roomcount").val())+(bfmoney*$("#addbfcount").val()))+"元</span>");
	}else{
		if($("#ishistory").val()==1){
		$("#hotelmoney_up").val((totalMoney*$("#roomcount").val()));
		}
		$("#allCountCost").html("费用总计：<span>¥"+((totalMoney*$("#roomcount").val()))+"元</span>");
	}
}
$(".colseKe").click(function(){
		$(".mBox").hide();
	});
function checkAlwaysUserName(count){
	var i=count;
	if(document.getElementById("alwayuser"+i).checked==true){
	$("#checkusernamevalue"+i).val("1");
	}else{
	$("#checkusernamevalue"+i).val("0");
	}
	
}
function setAlwaysName_NoAlways(names,values){
	$("#contactuser").val(values);
	$("#contactuser").removeClass("onFormError");
	$("#errorMessageContactuser").css({"display": "none"});
	$("#divPopConNoAlways").css({"display": "none"});
}
function setAlwaysName(names,values){
	if(names!=null && names!=""){
	$("#username"+names).val(values);
	$("#usernamehidden"+names).val(values);
	$("#divPop").css({"display": "none"});
	}else{
	 var countId=$("#countId").val();
	$("#username"+countId).val(values);
	$("#usernamehidden"+countId).val(values);
	$("#divPop").css({"display": "none"});
	}
}
function setContactName(name,mobile,email){
	$("#contactuser0").val(name);
	if(mobile==null || mobile=="null"){
		mobile="";
	}
	if(email==null || email=="null"){
		email="";
	}
	$("#mobilephone").val(mobile);
	$("#email").val(email);
	$("#divPopCon").css({"display": "none"});
}
function setId(id){
$("#countId").val(id);
}
function updateRoomCount(totalMoney,isAlways,isMember){
	var str="";
	
	var roomcount=$("#roomcount").val();
	$("#selectedValue").val(roomcount);
	for(i=0;i<roomcount;i++){
	str+="<ul><li class=\"txt\"><span>*</span>姓&nbsp;&nbsp;&nbsp;&nbsp;名：</li>"
	str+="<li id=\"userNameLi"+i+"\">";
	if(isAlways==1){
	if($("#usernamehidden"+i).val()!=null && $("#usernamehidden"+i).val()!="" && $("#usernamehidden"+i).val()!="undefined" && $("#usernamehidden"+i).val()!=undefined){
	str+="<input  id=\"username"+i+"\" name=\"username"+i+"\" value=\""+$("#usernamehidden"+i).val()+"\" type=\"text\" class=\"onInput arrde cusInput\"  onblur=\"javascript:titleUserNameBlue("+i+");\" onfocus=\"javascript:titleUserName("+i+");\"  /><a href=\"javascript:void(0)\" onclick=\"javascript:setId("+i+")\" class=\"morekesi\">更多客史</a>";
	}else{
	str+="<input  id=\"username"+i+"\" name=\"username"+i+"\" value=\"\" type=\"text\" class=\"onInput arrde cusInput\"  onblur=\"javascript:titleUserNameBlue("+i+");\" onfocus=\"javascript:titleUserName("+i+");\" /><a href=\"javascript:void(0)\" onclick=\"javascript:setId("+i+")\" class=\"morekesi\">更多客史</a>";
	}
	
	}else{
	if($("#usernamehidden"+i).val()!=null && $("#usernamehidden"+i).val()!="" && $("#usernamehidden"+i).val()!="undefined" && $("#usernamehidden"+i).val()!=undefined){
	str+="<input  id=\"username"+i+"\" name=\"username"+i+"\" value=\""+$("#usernamehidden"+i).val()+"\" type=\"text\" class=\"onInput arreded\"  onblur=\"javascript:titleUserNameBlue("+i+");\" onfocus=\"javascript:titleUserName("+i+");\"   />";	
	}else
	{
	str+="<input  id=\"username"+i+"\" name=\"username"+i+"\" value=\"\" type=\"text\" class=\"onInput arreded\"  onblur=\"javascript:titleUserNameBlue("+i+");\" onfocus=\"javascript:titleUserName("+i+");\"   />";
	}
	
	}
	str+="<div id=\"errorMessageUsername"+i+"\" class=\"errorLeftPrompt\" style=\"display: none;\">";
	str+="<div class=\"pmt\" id=\"errorContentUsername"+i+"\">";
    str+="<p></p>";
	str+="<div class=\"inArr\"></div>";
    str+="</div>";
	str+="</div>";
	
	/*if(isMember==1){
	str+="&nbsp;<input type=\"checkbox\" checked=\"checked\" id=\"alwayuser"+i+"\" name=\"alwayuser"+i+"\" onclick=\"javascript:checkAlwaysUserName(0);\"/>&nbsp;保存为常用人";
    str+="<input type=\"hidden\" id=\"checkusernamevalue"+i+"\" name=\"checkusernamevalue"+i+"\" value=\"1\"/>";
	}
	if($("#username"+i).val()!=null && $("#username"+i).val()!="" && $("#username"+i).val()!="undefined" && $("#username"+i).val()!=undefined){
	str+="<input type=\"hidden\" id=\"usernamehidden"+i+"\" value=\""+$("#username"+i).val()+"\"/>";
	}else{
	str+="<input type=\"hidden\" id=\"usernamehidden"+i+"\" value=\"\"/>";
	}*/
	str+="</li></ul>";
	}
	
  	str+="<input type=\"hidden\" id=\"countId\" name=\"countId\"/>";
	str+="<ul><li class=\"txt\">最晚到达时间：</li><li><select id=\"lasttime\" name=\"lasttime\">";
	str+="<option value=\"17\" selected=\"selected\">17:00</option>";
	str+="<option value=\"9\">09:00</option>";
	str+="<option value=\"10\">10:00</option>";
	str+="<option value=\"11\">11:00</option>";
	str+="<option value=\"12\">12:00</option>";
	str+="<option value=\"13\">13:00</option>";
	str+="<option value=\"14\">14:00</option>";
	str+="<option value=\"15\">15:00</option>";
	str+="<option value=\"16\">16:00</option>";
	str+="<option value=\"18\">18:00</option>";
	str+="<option value=\"19\">19:00</option>";
	str+="<option value=\"20\">20:00</option>";
	str+="<option value=\"21\">21:00</option>";
	str+="<option value=\"22\">22:00</option>";
	str+="<option value=\"23\">23:00</option>";
	str+="<option value=\"24\">23:59</option>";
	str+="</select>";
	str+=" 请于您指定的最晚到店时间前3小时内到店。";
	str+="</li>";
    str+="</ul>";
	
	$("#changeInnerUser").html(str);
	
	$.ajax({  
		url : "/hotel/selectAlwaysUser.do",  
		data : {},  // 参数  
		type : "post",  
		cache : true,  
		dataType : "json",  //返回json数据
		error: function(){},
		success: onchangecallback4businesscircle
	});
	
	
	
	
	$("#roomCountNum").html("&nbsp;"+$("#roomcount").val()+"&nbsp;");
	if(document.getElementById("checkAddbf")!=null && document.getElementById("checkAddbf").checked==true){
		$("#hotelmoney").val(((totalMoney*$("#roomcount").val())+($("#addbfcount").val()*$("#bfprice_up").val())));
		$("#hotelmoney_up").val(((totalMoney*$("#roomcount").val())+($("#addbfcount").val()*$("#bfprice_up").val())));
		$("#allCountCost").html("费用总计：<span>¥"+((totalMoney*$("#roomcount").val())+($("#addbfcount").val()*$("#bfprice_up").val()))+"元</span>");
	}else{
	$("#hotelmoney").val(((totalMoney*$("#roomcount").val())));
	$("#hotelmoney_up").val(((totalMoney*$("#roomcount").val())));
	$("#allCountCost").html("费用总计：<span>¥"+(totalMoney*$("#roomcount").val())+"元</span>");
	}
	
	
	
	
}
function onchangecallback4businesscircle(data){
  	var roomcount=$("#roomcount").val();
  	
  	var str="";
	var ajaxstr="";
	ajaxstr+="<div class=\"mBox\" id=\"divPop\">";
	ajaxstr+="<div class=\"mT\"><span>请直接输入或选择</span><a href=\"javascript:void(0)\" class=\"colseKe\" title=\"关闭\">关闭</a></div>";
  	ajaxstr+="<div class=\"mglist\">";
    ajaxstr+="<ul>";
    for(j=0;j<data.length;j++){
        ajaxstr+="<li onclick=\"javascript:setAlwaysName('','"+data[j].psgname+"');\">"+data[j].psgname+"</li>";
    }
    ajaxstr+="</ul>";
  	ajaxstr+="</div>";
  	ajaxstr+="</div>";
  	
  	str+=ajaxstr;
	
	
	$("#allKeList").html(str);

$(function(){

	$(".cusInput").click(function(event){
		event.stopPropagation();
		var offset = $(event.target).offset();
		$("#divPop").css({top:offset.top+2+$(event.target).height()+"px",
		left:offset.left});
		$("#divPop").bgiframe();
		$("#divPop").show();
	});
	$(document).click(function(event){$("#divPop").hide();});
});
//客史绑定事件处理 For IE OR Position
$(function(){
	
	$(".morekesi").click(function(event){
		event.stopPropagation();
		var offset = $(event.target).offset();
		$("#divPop").css({top:offset.top+2+$(event.target).height()+"px",
		left:offset.left-144});
		$("#divPop").bgiframe();
		$("#divPop").show();
	});
});

	$(function(){
	
	$(".arrde").hover( 
	function () { 
		$(this).addClass("arred");
	}, 
	function () { 
		$(this).removeClass("arred");
	}
	)
	});
	$(".colseKe").click(function(){
		$(".mBox").hide();
	});
	$(".mglist li").hover(function(){
		$(".mglist li").removeClass("current");
		$(this).addClass("current");
	});
	
}

function changeBreakFast(totalMoney,bfmoney){
	if(document.getElementById("checkAddbf").checked==true){
		$("#addBF").html("加订早餐<span>&nbsp;¥"+bfmoney+"&nbsp;</span>*<span>&nbsp;"+$("#addbfcount").val()+"&nbsp;</span>份");
		if($("#ishistory").val()==1){
		$("#hotelmoney_up").val((totalMoney*$("#roomcount").val())+(bfmoney*$("#addbfcount").val()));
		}
		$("#allCountCost").html("费用总计：<span>¥"+((totalMoney*$("#roomcount").val())+(bfmoney*$("#addbfcount").val()))+"元</span>");
	
	}else{
		if($("#ishistory").val()==1){
		$("#hotelmoney_up").val(totalMoney*$("#roomcount").val());
		}
		$("#allCountCost").html("费用总计：<span>¥"+(totalMoney*$("#roomcount").val())+"元</span>");
	}
} 
